<div id="content">
    <div class="container">
        <div id="main">
            <div class="search-result box" style="margin-top: 20px">
                <h2><?php echo lang('archivo_de_noticias');?></h2>
            </div>

            <div id="archives" class="box clearfix">
                <h6 class="list-title"><?php echo lang('categorias');?></h6>
                <h6 class="list-title"><?php echo lang('archivo_anual');?></h6>
                <h6 class="list-title last"><?php echo lang('archivo_mensual');?></h6>
                <span class="archive-trigger"><img src="<?php echo base_url();?>public/images/collapse-button-up.png" alt="collapse-button" /></span>
                <div class="clear"></div>
                <div class="content">
                    <hr class="full" />
                    <ul>
			<?php foreach( $categories as $categoria ):?>
                            <li><a href="<?php echo site_url('category/'.$categoria->slug);?>"><?php echo $categoria->category_name;?></a></li>
			<?php endforeach; ?>
                    </ul>
                    <ul>
                        <?php $valor_anterior = "";?>
                        <?php foreach ($years as $post): ?>
                            <?php if($valor_anterior == "" || $valor_anterior != mdate('%Y', human_to_unix($post->entry_date))){?>
                                <li>
                                    <a href="<?php echo site_url('year/'.mdate('%Y', human_to_unix($post->entry_date)));?>">
                                        <?php echo mdate('%Y', human_to_unix($post->entry_date)); ?>
                                    </a>
                                </li>
                            <?php }?>
                            <?php $valor_anterior = mdate('%Y', human_to_unix($post->entry_date));?>
                        <?php endforeach; ?>
                    </ul>
                    <ul class="last">
                        <?php $valor_anterior = "";?>
                        <?php foreach ($years as $post): ?>
                            <?php if($valor_anterior == "" || $valor_anterior != mdate('%m%Y', human_to_unix($post->entry_date))){?>
                                <li>
                                    <a href="<?php echo site_url('year/'.mdate('%Y', human_to_unix($post->entry_date)))."/".mdate('%m', human_to_unix($post->entry_date));?>">
                                        <?php echo lang("mes".mdate('%m', human_to_unix($post->entry_date)))." ".mdate('%Y', human_to_unix($post->entry_date)); ?>
                                    </a>
                                </li>
                            <?php }?>
                            <?php $valor_anterior = mdate('%m%Y', human_to_unix($post->entry_date));?>
                        <?php endforeach; ?>                        
                    </ul>
                </div>
            </div><!-- end #archives -->

            <div class="search-result box">
                <?php if(isset($category)){ foreach ($category as $row): ?>
                    <h2><?php echo lang('resultados_para');?>: &ldquo;<?php echo ucwords($row->category_name);?>&rdquo;</h2>
                <?php endforeach; } else{ ?>
                    <h2>
                        <?php echo lang('resultados_para');?>:&nbsp;
                        &ldquo;<?php echo ($this->uri->segment(3) != '' ? lang("mes".$this->uri->segment(3))." " : '').$this->uri->segment(2);?>&rdquo;
                    </h2>
                <?php }?>
            </div><!-- end .search-result -->
            <?php foreach ($query as $post): ?>
                <div class="entry collapsible">
                    <div class="entry-header">
                        <h2 class="title"><a href="<?php echo site_url('post/'.$post->entry_id); ?>"><?php echo $post->entry_name ?></a></h2>
                        <p class="meta"><?php echo lang('posteado_por')." ";?>&nbsp;|&nbsp;<?php echo lang('el_dia');?>&nbsp;<a href="#"><?php echo mdate('%n %M %Y %H:%i:%s', human_to_unix($post->entry_date)); ?></a></p>
                        <a class="button news-trigger" href="#"><?php echo lang('leer_mas');?>...</a>
                    </div><!-- end .entry-header -->
                    <div class="collapsible-content">
                        <div class="entry-content">
                            <?php echo $post->entry_body;?>
                        </div>
                    </div>
                </div><!-- end .entry -->
            <?php endforeach; ?>
        </div>
        <?php include 'menu_sidebar.php';?>
        <div class="clear"></div>
    </div><!-- end .container -->
</div><!-- end #content -->